<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<script type="text/javascript">
			//第1题 作用域
//			var num1 = 55;
//			var num2 = 66;//100
//
//			function f1(num, num1) {
//				// var num =55;
//				// var num1 = 66;
//				num = 100;//100
//				num1 = 100;//100
//				num2 = 100;//100
//				console.log(num);//100
//				console.log(num1);//100
//				console.log(num2);//100
//			}
//			//  55    66
//			f1(num1, num2);
//			console.log(num1);//55
//			console.log(num2);//100
//			console.log(num);// 报错
//=====================================================================
			//第2题  值类型和引用类型的传递
			function Person(name, age, salary) {
				this.name = name;
				this.age = age;
				this.salary = salary;
			}

			function f1(person) {
				//var person = p;
				person.name = "ls";
				person = new Person("aa", 18, 10);
			}

			var p = new Person("zs", 18, 1000);
			console.log(p.name);//zs
			f1(p);
			console.log(p.name);//ls
		</script>
	</body>

</html>